const mock = require('mockjs')
const random = mock.Random

const returnQuestionList = require('../mock/index')
const { response } = require('express')
const getComponentList = require('../utils/getComponentList')
module.exports = [
    //发布问卷
    {
        url:'/api/publish/:id',
        method:'post',
        response(req){
            return{
                error:0,
                msg:'发布成功'
            }
        }
    },
    //修改问卷信息
    {
        url:'/api/questiondetail',
        method:'post',
        response(req){
            return{
                error:0,
                msg:'提交成功'
            }
        }
    },
    //获取问卷信息
    {
        url:'/api/questiondetail/:id',
        method:'get',
        response(req){
            return {
                error:0,
                data:{
                    title:'问卷标题',
                    desc:'问卷描述',
                    jscode:'',
                    csscode:'',
                    list:getComponentList()
                },
                msg:'获取成功'
            }
        }
    },
    //获取问卷列表
    {
        url:'/api/question/list',
        method:'get',
        response(req){
            return {
                error:0,
                data:{
                    list:returnQuestionList(req),
                    total:100
                }
            }
        }
    },
    //修改问卷列表
    {
        url:'/api/question/:id',
        method:'delete',
        response(req){
            return{
                error:0,
                msg:'删除成功'
            }
        }
    },
    //复制问卷
    {
        url:'/api/question/copy/:id',
        method:'get',
        response(req){
            return{
                error:0,
                data:{
                    _id:random.id()
                },
                msg:'删除成功'
            }
        }
    },
    //修改问卷属性
    {
        url:'/api/question/:id',
        method:'put',
        response(req){
            return{
                error:0,
                msg:'修改成功'
            }
        }
    },
    //彻底删除
    {
        url:'/api/question',
        method:'delete',
        response(req){
            return{
                error:0,
                msg:'删除成功'
            }
        }
    },
]